﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class User_ProductList : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            try
            {
                string LoaiSP = Request.QueryString["LoaiSP"].ToString();
                SanPhamCtr SanPhamCtr = new SanPhamCtr();
                DataTable dataTable = SanPhamCtr.GetDSSanPhamTheoMa(LoaiSP);
                CollectionPager1.PageSize = 6;// Số items muốn hiển thị trên 1 trang.
                CollectionPager1.DataSource = dataTable.DefaultView;
                CollectionPager1.BindToControl = dlDSSanPham;
                dlDSSanPham.DataSource = CollectionPager1.DataSourcePaged;

            }
            catch 
            {
                //ScriptManager.RegisterStartupScript(this, this.GetType(), "alert",
                // "alert('URL không hợp lệ!');", true);
                Response.Redirect("NotFound.aspx");
                
            }
        }

    }
}